﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Text;

namespace MapControl.Misc.GPSPoint
{
    /// <summary>
    /// Class dùng để vẽ tọa độ các sân bay
    /// </summary>
    public class GPSAirportPoint : BaseGPSPoint
    {
        public GPSAirportPoint(string name, double lon, double lat, double alt, double speed, double angle, DateTime time, int satnum)
            : base(name, lon, lat, alt, speed, angle, time, satnum)
        {

        }

        private void DrawSymbol(Graphics g, Color color, string label)
        {
            Pen pen = new Pen(color, 1);
            InitRect();

            g.DrawEllipse(pen, Rect);
            Font myFont = new Font("Times New Roman", 10);
            //RectangleF labelRect = new RectangleF(Rect.Right, Rect.Bottom, 20,20);
            //g.DrawString(label, myFont, Brushes.White, labelRect);
            g.DrawString(label, myFont, Brushes.WhiteSmoke, Rect.Right, Rect.Bottom);
            pen.Dispose();
        }

        #region Override Functions
        protected override void InitRect()
        {
            //Kích thước cố định 64 x 64 pixel
            int width, height;
            width = 10;
            height = 10;
            Rect = new RectangleF(CenterPoint.X - (float)width / 2, CenterPoint.Y - (float)height / 2, width, height);
        }

        /// <summary>
        /// Vẽ các tọa độ gps
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g)
        {
            DrawSymbol(g, Color.Red, "");
        }

        /// <summary>
        /// Vẽ các tọa độ gps
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g, string label)
        {
            DrawSymbol(g, Color.Red, label);
        }

        /// <summary>
        /// Vẽ các tọa độ gps
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g, Color color)
        {
            DrawSymbol(g, color, "");
        }

        /// <summary>
        /// Vẽ các tọa độ gps
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g, Color color, Color border)
        {
            DrawSymbol(g, color, "");
        }
        #endregion

    }
}
